<template>
<div class="pay-setting views-container">
    <div class="wlm-form">
        <div class="wlm-form-header">交易设置</div>
        <div class="wlm-form-content">
            <el-form :ref="formFormatData.key" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="190px" class="retail-form" label-position="right">
                <el-form-item label="待付款后取消订单时间" prop="order.close_minutes" :rules="[{ required: true, message: '请输入取消订单时间', trigger: 'blur' }]">
                    <el-input @input.native="clearNativeReg(formFormatData.formData.order,'close_minutes')" v-model.trim="formFormatData.formData.order.close_minutes">
                        <template slot="append">分钟</template>
                    </el-input>
                </el-form-item>
                <el-form-item label="发货后自动确认收货时间" prop="order.receive_minutes" :rules="[{ required: true, message: '请输入确认收货时间', trigger: 'blur' }]">
                    <div class="input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                        <el-input-number :controls="false" size="small" v-model="formFormatData.formData.order.receive_minutes"></el-input-number>
                        <div class="wlm-input-append append-right">天</div>
                    </div>
                </el-form-item>
                <el-form-item label="收货后不能发起售后时间" prop="order.after_sale_minutes" :rules="[{ required: true, message: '请输入不能发起售后时间', trigger: 'blur' }]">
                    <div class="input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                        <el-input-number :controls="false" size="small" v-model="formFormatData.formData.order.after_sale_minutes"></el-input-number>
                        <div class="wlm-input-append append-right">天</div>
                    </div>
                </el-form-item>
                <el-form-item label="退款手续费" prop="order.order_commission" :rules="[{ required: true, message: '请输入退款手续费', trigger: 'blur' }]">
                    <div class="input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                        <el-input-number :controls="false" size="small" :min="0" :max="100" v-model="formFormatData.formData.order.order_commission"></el-input-number>
                        <div class="wlm-input-append append-right">%</div>
                    </div>
                </el-form-item>
                <el-form-item label="订单到期前" prop="order.expire_tips" :rules="[{ required: true, message: '订单到期提醒', trigger: 'blur' }]">
                    <div class="input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                        <el-input  size="small" v-model="formFormatData.formData.order.expire_tips"></el-input>
                        <div class="wlm-input-append append-right" style="position: absolute;left: 230px;top: 0px;">天提醒</div>
                    </div>
                    <div class="form-help">注：如果一个订单需要多次提醒，请将多个数字用“|”隔开，如：0.5|1|1.5</div>
                </el-form-item>
                  <el-form-item label="到期订单自动退款">
                     <el-radio-group v-model="formFormatData.formData.order.self_refund">
                        <el-radio label="1">开启</el-radio>
                        <el-radio label="2">关闭</el-radio>
                     </el-radio-group>
                </el-form-item>
                <!-- <el-form-item label="下单页样式">
                    <el-radio-group v-model="formFormatData.formData.order.trade_style">
                        <el-radio label="0">默认（需要填写姓名电话）</el-radio>
                        <el-radio label="1">简易（只需要填写电话）</el-radio>
                    </el-radio-group>
                </el-form-item> -->
            </el-form>
        </div>
    </div>
    <div v-cloak class="wlm-fixed-btn flex-row flex-align-c flex-justify-c">
        <el-button size="small" @click="formFormatSubmit" type="primary">保存</el-button>
    </div>
</div>
</template>

<script>
import {
  orderSettingGet,
  orderSettingSave
} from '@/api/orders'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Form')],
  name: 'PaySetting',
  components: {

  },
  directives: {

  },
  data() {
    return {
      licensedCode: '',
      formFormatData: {
        key: 'userForm',
        api: {
          editForm: {
            api: orderSettingGet,
            params: {
              type: 'order',
              always: true
            }
          },
          submitForm: orderSettingSave
        },
        formData: {
          type: 'order',
          order: {
            close_minutes: '',
            receive_minutes: '',
            after_sale_minutes: '',
            trade_style: '1',
            order_commission: '',
            expire_tips: 3,
            self_refund:'2'
          }
        },
        rules: {

        }
      }
    }
  },
  methods: {}
}
</script>

<style lang="scss" scoped>
.pay-setting {
}
</style>
